

cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Replication\Log files\Appendix Tables"
clear
log using TableA7.txt, text replace 

***First stages with interactions
clear
cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Data"
use LPSU_MainSample_Sep2024, replace
set matsize 10000
cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Tables"

***Set of fixed effects
egen sic1year=group(sic1 year)
qui tabulate sic1year, generate(dsic1year)
egen month_post= group(month post)
qui tabulate month_post, generate(dmonth)
qui tabulate year_around_ipo, generate(deventyear) 

eststo clear 

***Setting the sample to the IV sample (dropping observations colinear with FEs)
set more off
qui xtivreg2 wroa (IPO=instrument) deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth* , fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
gen sample_IV=e(sample) 
keep if sample_IV==1
**Dropping firms for which ROA only has one observation
bysort id: egen count=count(year)
drop if count==1 

**Columns 1 and 2
***Financial dependence
set more off
eststo:qui xtreg IPO instrument instrument_fin_dep_eu_hi deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
outreg2 using Table_FS_interact.xls, keep(instrument instrument_fin_dep_eu_hi) sortvar(instrument instrument_fin_dep_eu_hi instrument_small_s instrument_high_self instrument_Y) tex(frag) excel  bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)  replace

set more off
eststo:qui xtreg IPO_fin_dep_eu_hi instrument instrument_fin_dep_eu_hi deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
outreg2 using Table_FS_interact.xls, keep(instrument instrument_fin_dep_eu_hi) sortvar(instrument instrument_fin_dep_eu_hi instrument_small_s instrument_high_self instrument_Y) tex(frag) excel  bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)
 
esttab,   keep(instrument instrument_fin_dep_eu_hi) order(instrument instrument_fin_dep_eu_hi) label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) ///
 addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage) 
eststo clear   
 
**Columns 3 and 4 
***Size
set more off
eststo:qui xtreg IPO instrument instrument_small_s deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
outreg2 using Table_FS_interact.xls, keep(instrument instrument_small_s) sortvar(instrument instrument_fin_dep_eu_hi instrument_small_s instrument_high_self instrument_Y) tex(frag) excel  bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)  

set more off
eststo:qui xtreg IPO_small_s instrument instrument_small_s deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
outreg2 using Table_FS_interact.xls, keep(instrument instrument_small_s) sortvar(instrument instrument_fin_dep_eu_hi instrument_small_s instrument_high_self instrument_Y) tex(frag) excel  bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)
 
esttab,   keep(instrument instrument_small_s) order(instrument instrument_small_s) label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) ///
 addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage) 
eststo clear    
 
**Columns 5 and 6  
**Young
set more off
eststo:qui xtreg IPO instrument instrument_Y deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
outreg2 using Table_FS_interact.xls, keep(instrument instrument_Y) sortvar(instrument instrument_fin_dep_eu_hi instrument_small_s instrument_Y instrument_high_self) tex(frag) excel  bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)  

set more off
eststo:qui xtreg IPO_Y instrument instrument_Y deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
outreg2 using Table_FS_interact.xls, keep(instrument instrument_Y) sortvar(instrument instrument_fin_dep_eu_hi instrument_small_s instrument_Y instrument_high_self) tex(frag) excel  bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage) 
 
esttab,   keep(instrument instrument_Y) order(instrument instrument_Y) label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) ///
 addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage) 
eststo clear    

**Columns 7 and 8   
**Anti-Self-dealing 
set more off
eststo:qui xtreg IPO instrument instrument_high_self deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
outreg2 using Table_FS_interact.xls, keep(instrument instrument_high_self) sortvar(instrument instrument_fin_dep_eu_hi instrument_small_s instrument_Y instrument_high_self) tex(frag) excel  bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)  

set more off
eststo:qui xtreg IPO_high_self instrument instrument_high_self deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
outreg2 using Table_FS_interact.xls, keep(instrument instrument_high_self) sortvar(instrument instrument_fin_dep_eu_hi instrument_small_s instrument_Y instrument_high_self) tex(frag) excel  bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage) 

esttab,   keep(instrument instrument_high_self) order(instrument instrument_high_self) label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) ///
 addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage) 
eststo clear   
 
 
eststo clear 


cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Replication\Log files\Appendix Tables"
log close   
 
 
 